package com.ruoyi.master.service.impl;

import java.util.List;
import com.ruoyi.common.core.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.master.mapper.TaskFavoriteMapper;
import com.ruoyi.master.domain.TaskFavorite;
import com.ruoyi.master.service.ITaskFavoriteService;

/**
 * 任务收藏夹Service业务层处理
 * 
 * @author jiandan
 * @date 2024-10-21
 */
@Service
public class TaskFavoriteServiceImpl implements ITaskFavoriteService 
{
    @Autowired
    private TaskFavoriteMapper taskFavoriteMapper;

    /**
     * 查询任务收藏夹
     * 
     * @param favoriteId 任务收藏夹主键
     * @return 任务收藏夹
     */
    @Override
    public TaskFavorite selectTaskFavoriteByFavoriteId(Long favoriteId)
    {
        return taskFavoriteMapper.selectTaskFavoriteByFavoriteId(favoriteId);
    }

    /**
     * 查询任务收藏夹列表
     * 
     * @param taskFavorite 任务收藏夹
     * @return 任务收藏夹
     */
    @Override
    public List<TaskFavorite> selectTaskFavoriteList(TaskFavorite taskFavorite)
    {
        return taskFavoriteMapper.selectTaskFavoriteList(taskFavorite);
    }

    /**
     * 新增任务收藏夹
     * 
     * @param taskFavorite 任务收藏夹
     * @return 结果
     */
    @Override
    public int insertTaskFavorite(TaskFavorite taskFavorite)
    {
        taskFavorite.setCreateTime(DateUtils.getNowDate());
        return taskFavoriteMapper.insertTaskFavorite(taskFavorite);
    }

    /**
     * 修改任务收藏夹
     * 
     * @param taskFavorite 任务收藏夹
     * @return 结果
     */
    @Override
    public int updateTaskFavorite(TaskFavorite taskFavorite)
    {
        taskFavorite.setUpdateTime(DateUtils.getNowDate());
        return taskFavoriteMapper.updateTaskFavorite(taskFavorite);
    }

    /**
     * 批量删除任务收藏夹
     * 
     * @param favoriteIds 需要删除的任务收藏夹主键
     * @return 结果
     */
    @Override
    public int deleteTaskFavoriteByFavoriteIds(Long[] favoriteIds)
    {
        return taskFavoriteMapper.deleteTaskFavoriteByFavoriteIds(favoriteIds);
    }

    /**
     * 删除任务收藏夹信息
     * 
     * @param favoriteId 任务收藏夹主键
     * @return 结果
     */
    @Override
    public int deleteTaskFavoriteByFavoriteId(Long favoriteId)
    {
        return taskFavoriteMapper.deleteTaskFavoriteByFavoriteId(favoriteId);
    }
}
